Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Uniswap Positions to be used as collateral on the Markets page #807

Merged
merged 5 commits into from
Feb 18, 2024

Conversation

haydenshively
Copy link
Member

@haydenshively haydenshively commented Feb 12, 2024

I think everything is working. Only annoying thing is that sometimes some dust is left in the BorrowerNFT after you withdraw the Uniswap position. I'm going to do some work on the contract side to fix that up. Then we'll be able to withdraw everything and give them their ante in a single transaction (right now it requires a refresh and an extra withdraw). edit: fixed

Also, we may want to refactor the BorrowingWidget soon. The data structures made sense when we were only dealing with tokens, but after this change portions of it feel a bit hacky.

Copy link

netlify bot commented Feb 12, 2024

Deploy Preview for aloe-blend-staging canceled.

Name Link
🔨 Latest commit c922989
🔍 Latest deploy log https://app.netlify.com/sites/aloe-blend-staging/deploys/65ce6c129a9c8f0008aa4749

Copy link

netlify bot commented Feb 12, 2024

Deploy Preview for aloe-prime canceled.

Name Link
🔨 Latest commit c922989
🔍 Latest deploy log https://app.netlify.com/sites/aloe-prime/deploys/65ce6c12b1079200079d87a6

Copy link

netlify bot commented Feb 12, 2024

Deploy Preview for aloe-earn ready!

Name Link
🔨 Latest commit c922989
🔍 Latest deploy log https://app.netlify.com/sites/aloe-earn/deploys/65ce6c1284f57e00076a1df6
😎 Deploy Preview https://deploy-preview-807--aloe-earn.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@haydenshively haydenshively force-pushed the hs-uniswap-positions-on-markets branch from 638262e to cc21ad1 Compare February 12, 2024 05:09
earn/src/data/MarginAccount.ts Show resolved Hide resolved
earn/src/components/lend/BorrowingWidget.tsx Outdated Show resolved Hide resolved
earn/src/components/lend/BorrowingWidget.tsx Show resolved Hide resolved
earn/src/components/lend/BorrowingWidget.tsx Show resolved Hide resolved
const hasNoCollateral =
account.assets.token0Raw === 0 &&
account.assets.token1Raw === 0 &&
(account.uniswapPositions?.length || 0) === 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could use ??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I usually prefer those, but for numbers you requested that I use the ||

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is only the case when we aren't defaulting to zero

earn/src/components/lend/BorrowingWidget.tsx Show resolved Hide resolved
earn/src/components/lend/BorrowingWidget.tsx Show resolved Hide resolved
earn/src/components/lend/BorrowingWidget.tsx Show resolved Hide resolved
Comment on lines +333 to +354
<SquareInputWithMax
size='L'
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
const output = formatNumberInput(event.target.value);
if (output != null) {
setBorrowAmountStr(output);
}
}}
value={borrowAmountStr}
onMaxClick={() => {
if (eightyPercentMaxBorrowAmountStr) {
setBorrowAmountStr(eightyPercentMaxBorrowAmountStr);
}
}}
maxDisabled={
eightyPercentMaxBorrowAmountStr === null || eightyPercentMaxBorrowAmountStr === borrowAmountStr
}
maxButtonText='80% Max'
placeholder='0.00'
fullWidth={true}
inputClassName={borrowAmountStr !== '' ? 'active' : ''}
/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use some UX improvements, we can talk about this offline

@haydenshively haydenshively merged commit c8b26e4 into master Feb 18, 2024
18 checks passed
@haydenshively haydenshively deleted the hs-uniswap-positions-on-markets branch February 18, 2024 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants